package com.yzp.controller;

import com.yzp.model.Result;
import com.yzp.model.StatusCode;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @title: BaseController
 * @Author: yzp
 * @Date: 2019/7/23 10:46
 * @Version 1.0
 */
@ControllerAdvice
public class BaseController {

    @ResponseBody
    @ExceptionHandler(Exception.class)
    public Result Error(Exception e) {
        return new Result(false, StatusCode.ERROR, "error:"+ e.getMessage());
    }
}
